<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>记账本 - 注册</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-md-12 page-header">
				<h2 class="text-center">
					记账本<br />
					<small>用户添加</small>
				</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-8">
				<ul class="nav nav-pills">
					<li class="active"><a href="index.html">首页</a></li>
					
					<li><a href="#">用户： <span id="text3"> </span>
					</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-4 col-md-offset-4">
				<div class="form-group">
					<label for="date_time">时间</label> <input type="datetime-local"
						class="form-control" id="date_time" />
				</div>
				<div class="form-group">
					<label for="place">地点</label> <input type="text"
						class="form-control" id="place" />
				</div>
				<div class="form-group">
					<label for="money_in">钱收入</label> <input type="text"
						class="form-control" id="money_in" />
				</div>
				<div class="form-group">
					<label for="money_out">钱支出</label> <input type="text"
						class="form-control" id="money_out" />
				</div>
				<div class="form-group">
					<label for="kind">种类</label> <input type="text"
						class="form-control" id="kind" />
				</div>
				<div class="form-group">
					<label for="remark">感觉</label> <input type="text"
						class="form-control" id="remark" />
				</div>
				<button id="adda" class="btn btn-primary btn-block">注册</button>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		$(function() {
			$.getJSON('query_nickname.action', function(res) {
				console.log(res);
				$('#text3').text(res.n);
			});
			$('#adda').click(function() {
				console.log($('#date_time').val());
				$.post('adda.action', {
					date_time : $('#date_time').val(),
					place : $('#place').val(),
					money_in : $('#money_in').val(),
					money_out : $('#money_out').val(),
					kind : $('#kind').val(),
					remark : $('#remark').val()
				}, function(res, status) {
					console.log("OK");
					window.location.href = "index.html"
				});
			});
		});
	</script>
</body>
</html>
